<template>
  <div class="common-layout">
    <el-container style="height: 100%">
      <el-header class="header-css">
        <Header/>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu
              :default-active="status.activeItem"
              active-text-color="#409eff"
              background-color="white"
              class="el-menu-vertical-demo"
              :router="true"
          >
            <el-menu-item index="/manager/shopManager">
              <el-icon class="index-icon"><document /></el-icon>
              <span>商店管理</span>
            </el-menu-item>
            <el-menu-item index="/manager/userManager">
              <el-icon class="index-icon"><document /></el-icon>
              <span>用户管理</span>
            </el-menu-item>
            <el-menu-item index="/manager/orderManager">
              <el-icon class="index-icon"><document /></el-icon>
              <span>订单管理</span>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main class="main-css">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import Header from "@/components/manager/Header.vue"
import {reactive, watch} from "vue";
import {useRoute} from "vue-router/dist/vue-router";

const route = useRoute();

const status = reactive({
  activeItem: "/manager/shopManager",
  ifPassed: false
});

watch(
    () => route.fullPath,
    (newVal) => {
      status.activeItem = newVal;
    },
    { immediate: true }
);


</script>

<style lang="scss" scoped>
.common-layout {
  width: 100%;
  height: 100%;
.header-css {
  margin-bottom: 1px;
  padding: 0
}
.main-css {
  padding: 15px;
  background-color: rgba(249, 249, 249, 1);
}
}
.index-icon {
  margin-top: -2px;
  margin-right: 5px;
}
</style>